<?php
    class PageController extends HangveController
    {
        /**
        * @return array action filters
        */
        public function filters()
        {
            return array(
                'accessControl', // perform access control for CRUD operations
                //'postOnly + delete', // we only allow deletion via POST request
            );
        }

        /**
        * Specifies the access control rules.
        * This method is used by the 'accessControl' filter.
        * @return array access control rules
        */
        public function accessRules()
        {
            return array(
                array('allow',  // allow all users to perform 'index' and 'view' actions
                    'actions'=>array('index','genarateCat', 'error'),
                    'users'=>array('*'),
                ),
                array('deny',  // deny all users 
                    'users'=>array('*'),
                ),
            );
        }

        public function init(){

            parent::init();
            //           if(!$this->user){
            //                $userIdentity = new CUserIdentity(6, '');
            //                $userIdentity->setState('id', 6);
            //                $userIdentity->setState('name', 6);
            //                $userIdentity->setState('username', 6);                      
            //                Yii::app()->user->login($userIdentity, 3600*24*365);     
            //            }  
        }
        

        public function actionError() {
            if($error = Yii::app()->errorHandler->error) {
                if (Yii::app()->request->isAjaxRequest)
                    echo $error['message'];
                else {
                    $view = 'error';
                    if (in_array($error['code'], array(404))) {
                        $view .= $error['code'];
                    }
                    $this->render($view, $error);
                }
            }
        }
        
        
        

        public function actionIndex()
        {   
            $this->render('index');
        }
        
    }
